﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FCDB.Entity;

namespace FCDB.Repository
{
    public class WfTransitionInstanceRepository : LogicBase, ILogic
    {

        public IList<WfTransitionInstance> GetTransitonInstance(string appName, long appInstanceID, Guid processGUID, short toActivityType)
        {
            var query = from item in DBHelper.WfTransitionInstance
                        where item.AppName == appName && item.AppInstanceID == appInstanceID && item.ProcessGUID == processGUID && item.ToActivityType == toActivityType
                        orderby item.CreatedDateTime descending
                        select item;
            return query.ToList();
            
            
        }

        public IList<WfTransitionInstance> GetTransitionInstanceList(long appInstanceID, Guid processGUID, long processInstanceID)
        {
            var query = from item in DBHelper.WfTransitionInstance
                        where item.AppInstanceID == appInstanceID && item.ProcessGUID == processGUID && item.ProcessInstanceID == processInstanceID 
                        orderby item.CreatedDateTime descending
                        select item;
            return query.ToList();
        }
    }
}
